<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05_版心与居中测试</title>
    <style>
        *{
            /*去除所有元素自带的内外间距*/
            margin: 0;
            padding: 0;
        }
        .main {
            background-color: #ff0;
        }
        .center {
            background-color: lightgreen;
            width: 1000px;
            margin: 0 auto;
        }
        .card {
            width:200px;
            height:300px;
            border:2px solid #000;
            background-color: lightcoral;
            margin: 0 auto;
            text-align: center;
            /*让卡片的行高与卡片高度一致,实现文字在卡片的垂直居中*/
            line-height:300px;

        }

    </style>

</head>
<body>
<!--最外面的当前层功能块-->
    <div class="main">
<!--  版心  -->
        <div class="center">
<!--主要展示的具体内容-->
            <div class="card">我是内容</div>
            <div class="card">我是内容</div>
            <div class="card">我是内容</div>
            <div class="card">我是内容</div>
        </div>

    </div>
</body>
</html>